using Godot;
using System;

[GlobalClass]
public partial class Hurtbox : Area2D
{
    [Signal]
    public delegate void HurtEventHandler(Hitbox otherHurtbox);

    public override void _Ready()
    {
        AreaEntered += OnAreaEntered;
    }

    private void OnAreaEntered(Area2D otherHitbox)
    {
        if (otherHitbox is not Hitbox) return;
        EmitSignal(SignalName.Hurt, otherHitbox);    
    }
}
